<!DOCTYPE html>

<html lang="zh-cn">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="/static/css/bootstrap.css?v=0923" rel="stylesheet">
<link href="/static/css/bootstrap-theme.css?v=0923" rel="stylesheet">
<link href="/static/css/dashboard.css?v=0923" rel="stylesheet">
<link href="/static/css/font-awesome.css?v=0923" rel="stylesheet">
<link href="/static/css/site.css?v=0923" rel="stylesheet">
<link href="/static/css/bootstrap-datetimepicker.css?v=0923" rel="stylesheet">
<link href="favicon.ico" type="image/x-icon" rel=icon>
<style type="text/css">
label {
    font-weight: normal !important;
}
select {
    height: 30px;
}
</style>

<script src="/static/js/jquery.2.1.1.js"></script>
<script src="/static/js/bootstrap.3.2.0.js"></script>
<script type='text/javascript' src="/static/js/moment.js?v=0924"></script>
<script type='text/javascript' src="/static/js/bootstrap-datetimepicker.js?v=0924"></script>

<title>后台管理系统</title>
<body data-spy="scroll" data-target=".subnav" data-offset="50" screen_capture_injected="true" onload="startTime()">
<div>
{% if not request.session.username %}
	{% include "login.html" %}
{% else %}

</div>

	<div class="navbar navbar-inverse navbar-fixed-top">
		<div class="container">
			<div class="row">
				<div class="col-sm-4 nav navbar-nav"><div style="color:#f5f5f5;margin-top: 12px;">当前时间：<font color="#33FFFF"><span id="nowDateTimeSpan"></span></font></div></div>
				<div class="col-sm-8">
					<div>
						<ul class="nav navbar-nav navbar-right">
							<li class="dropdown">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="color:#f5f5f5;font-size:18px">
								{{request.session.username}}
								<b class="caret"></b>
								</a>
								<ul class="dropdown-menu">
									<li><a href="/admins/admin_edit">密码修改</a></li>
									{% if request.session.groupid == '31'%}
									<li class="divider"></li>
									<li><a href="/admins/admin_list">用户权限</a></li>
									{% endif %}
									<li class="divider"></li>
									<li ><a href="/admins/quit" style="background-color:#d9534f;color:#fff">退出</a></li>
								</ul>
							</li>
							 
						</ul>

					</div>
				</div>
			</div>
		</div>
	</div>
<!-- 左边菜单栏 -->
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-1">
			<div class="col-sm-1 sidebar" style="width: 10%" >
				<ul id="main-nav" class="nav nav-sidebar">
					{% if request.session.menu  %}
						{% for tab,value in  request.session.menu.items %}
							<li>
								<a href="#{{tab}}" class="nav-header collapsed" data-toggle="collapse">
									<i class="glyphicon glyphicon-user"></i>
										{{value.name}}
								</a>

								<ul id="{{tab}}" class="nav nav-list collapse secondmenu" style="height: 0px;margin-left: 20px">
									{% for submenu in value.sub_menu %}
										<li><a href="/admins/{{submenu.action}}">{{submenu.name}}</a></li>
									{% endfor %}
								</ul>

							</li>
						{% endfor %}
					{% endif %}
		            </ul>
		        </div>
			</div>
		<div class="col-sm-11 " style="margin-top: 20px;width: 90%;margin-left: 20px">
			{% block content %}
           	 <div class="alert alert-info">title<font color="red"> alert</font></div>
				<form action="admincp.php?mod=modify&act=army&type=1" method="POST">
					<span>用户名</span>
					<span><input type="text" id="username" name="username" value=''/></span>
					<span>UID</span>
					<span><input type="text" id="useruid" name="useruid" value=''/></span>
					<span><input class="btn btn-primary" type="submit" value="查询" /></span>
				</form>
			</div>
		{% endblock %}
	</div>
</div>
{% endif %}
<script type="text/javascript">
var backFunc = null;//回调函数名
function showLogin(f){
	backFunc = f;
	var windowWidth = document.documentElement.clientWidth;	
	var windowHeight = document.documentElement.clientHeight;	
	//居中设置	
	$("#openwindow").css({	
	"position": "absolute",	
	"top": windowHeight/2 - $("#openwindow").height()/2,	
	"left": windowWidth/2 - $("#openwindow").width()/2	
	});	
	$('#openwindow').fadeIn("slow");
}
function closeLogin(){
	$('#openwindow').fadeOut("slow");
}
function relogin(){
	var url =''
	xmlHttp=getAjax();
	xmlHttp.onreadystatechange = loginHandler;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function loginHandler(){
	if(xmlHttp.readyState==4 && xmlHttp.status==200){
		if(xmlHttp.responseText == 0){
			alert('登陆成功');
			$('#openwindow').fadeOut("slow");
			if(backFunc)//执行回调函数
				backFunc();
		}else{
			alert('用户名或密码错误');
		}
	}
}
function getAjax(p){
	if(window.XMLHttpRequest){//非IE内核浏览器
		p=new XMLHttpRequest();
	}else if(window.ActiveXObject){//IE内核浏览器
	   try{//IE6.0
		   p=new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e1){
		  try{
			  p=new ActiveXObject("MSXML2.XMLHTTP");
		   }catch(e2){
			 try{
				 p=new ActiveXObject("MSXML3.XMLHTTP");
			  }catch(e3){
				 alert("创建Ajax失败："+e3)
			  }
		   }
		}
	}else{//未知浏览器
		alert("未能识别的浏览器");
	}
	return p;
}

$(document).click(function (e) {
	if(e.target.id != null){
		var idArr = e.target.id.split('_');
		if(idArr[0]=='server'){
			if(idArr[1]=='control'){
				showServerList();
				return;
			}
		}
	}
	hideServerList();
});
function showServerList(){
 	$('#server_list').show();
 	$("#server_control").removeClass("dropdown").addClass('dropdown open');
 }
function hideServerList(){
 	$('#server_list').hide();
 	$("#server_control").removeClass("dropdown open").addClass('dropdown');
 }
 function startTime()
{
	var today=new Date();//定义日期对象
	var yyyy = today.getFullYear();//通过日期对象的getFullYear()方法返回年
	var MM = today.getMonth()+1;//通过日期对象的getMonth()方法返回年
	var dd = today.getDate();//通过日期对象的getDate()方法返回年
	var hh=today.getHours();//通过日期对象的getHours方法返回小时
	var mm=today.getMinutes();//通过日期对象的getMinutes方法返回分钟
	var ss=today.getSeconds();//通过日期对象的getSeconds方法返回秒
	// 如果分钟或小时的值小于10，则在其值前加0，比如如果时间是下午3点20分9秒的话，则显示15：20：09
	MM=checkTime(MM);
	dd=checkTime(dd);
	mm=checkTime(mm);
	ss=checkTime(ss);
	var day; //用于保存星期（getDay()方法得到星期编号
	var daylist = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]
	day = daylist[today.getDay()]

	document.getElementById('nowDateTimeSpan').innerHTML=yyyy+"-"+MM +"-"+ dd +" " + hh+":"+mm+":"+ss+"   " + day;
	setTimeout('startTime()',1000);//每一秒中重新加载startTime()方法
}

function checkTime(i)
{
	if (i<10){
		i="0" + i;
	}
	  return i;
}


</script>
</body>